/**
 * Copyright (c) 2012-2014, Yang Yang <cntototo@gmail.com>
 *
 * This software may be distributed under the terms of the New BSD License.
 * See README for more details.
 */

#ifndef STA_H
#define STA_H

#include "def.h"
#include "event.h"
#include "if_manager.h"

enum wfs_sta_status_associate {
	/** No associate request */
	STA_ASSOC_NONE,
	/** Associate request is already pending */
	STA_ASSOC_PENDING,
	/** Associate request is already running */
	STA_ASSOC_RUNNING,
};

struct wfs_sta_status {
	enum wfs_sta_status_associate associate;
};

struct wfs_sta_info {
	struct wfs_sta_status status;
	struct wfs_timeval *scan_start_time;
	struct wfs_driver_assoc_params *assoc_params;
	struct wfs_driver_scan_params *scan_params;
	struct wfs_driver_scan_results *scan_results;
};

void sta_assoc_timer(void *ctx);

enum wfs_internal_err
sta_cancel_scan(struct wfs_iface *cur_if);

void sta_deinit(struct wfs_sta_info **sta_info);

enum wfs_internal_err
sta_evt_scan_results(struct wfs_iface *cur_if, union wfs_event_data *event);

enum wfs_internal_err
sta_evt_trigger_scan(struct wfs_iface *cur_if);

enum wfs_internal_err
sta_init(struct wfs_sta_info **sta_info);

void sta_scan_timer(void *ctx);

#endif /* STA_H */
